home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / 1.2 / scripts / rendermap.scm.z / rendermap.scm
Text File  |  2002-07-08  |  3KB  |  81 lines

  1. ;
  2. ;
  3. ;
  4. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  5. ; At ECS Dept, University of Southampton, England.
  6.  
  7. ; This program is free software; you can redistribute it and/or modify
  8. ; it under the terms of the GNU General Public License as published by
  9. ; the Free Software Foundation; either version 2 of the License, or
  10. ; (at your option) any later version.
  11. ; This program is distributed in the hope that it will be useful,
  12. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ; GNU General Public License for more details.
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program; if not, write to the Free Software
  17. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.  
  20. (define (script-fu-render-map inSize inGrain inGrad inWiden)
  21.  
  22.     (set! old-gradient (car (gimp-gradients-get-active)))
  23.     (set! old-fg (car (gimp-palette-get-foreground)))
  24.     (set! old-bg (car (gimp-palette-get-background)))
  25.  
  26.         (set! theWidth inSize)
  27.     (set! theHeight inSize)
  28.         (set! theImage (car(gimp-image-new theWidth theHeight RGB)))
  29.  
  30.         (gimp-selection-all theImage)
  31.  
  32.         (set! theLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "I've got more rubber ducks than you!" 100 NORMAL)))
  33.         (gimp-image-add-layer theImage theLayer 0)
  34.         (plug-in-solid-noise TRUE theImage theLayer 1 0 (rand 65536) inGrain inGrain inGrain)
  35.  
  36.     (if (= inWiden 1) (begin
  37.             (set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA_IMAGE "Camo Thin Layer" 100 NORMAL)))
  38.             (gimp-image-add-layer theImage thinLayer 0)
  39.         (let     ((theBigGrain (min 15 (* 2 inGrain))))
  40.                      (plug-in-solid-noise TRUE theImage thinLayer 1 0 (rand 65536) theBigGrain theBigGrain theBigGrain)
  41.         )
  42.         (gimp-palette-set-background '(255 255 255))
  43.         (gimp-palette-set-foreground '(0 0 0))
  44.         (let     ((theMask (car(gimp-layer-create-mask thinLayer 0))))
  45.             (gimp-image-add-layer-mask theImage thinLayer theMask)
  46.             (gimp-blend theMask FG-BG-RGB NORMAL LINEAR 100
  47.                 0 REPEAT-TRIANGULAR FALSE 0 0 0 0 0 (/ theHeight 2) )
  48.         )
  49.         (set! theLayer (car(gimp-image-flatten theImage)))
  50.     ))
  51.     
  52.     (gimp-selection-none theImage)
  53.     (gimp-gradients-set-active inGrad)
  54.     (plug-in-gradmap TRUE theImage theLayer)
  55.         (gimp-gradients-set-active old-gradient)
  56.         (gimp-palette-set-background old-bg)
  57.         (gimp-palette-set-foreground old-fg)
  58.         (gimp-display-new theImage)
  59. )
  60.  
  61.  
  62.  
  63. ; Register the function with the GIMP:
  64.  
  65. (script-fu-register
  66.  "script-fu-render-map"
  67.  _"<Toolbox>/Xtns/Script-Fu/Patterns/Render Map..."
  68.  "Another pattern which resembles a map"
  69.  "Chris Gutteridge: cjg@ecs.soton.ac.uk"
  70.  "28th April 1998"
  71.  "Chris Gutteridge / ECS @ University of Southampton, England"
  72.  ""
  73.  SF-ADJUSTMENT _"Image Size" '(256 0 2048 1 10 0 0)
  74.  SF-ADJUSTMENT _"Granularity" '(4 0 15 1 1 0 0)
  75.  SF-GRADIENT   _"Gradient" "Land_and_Sea"
  76.  SF-OPTION     _"Behaviour" '(_"Tile" _"Detail in Middle")
  77. )
  78.  
  79.